home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
015
/
fflf.arc
/
FFLF.ASM
next >
Wrap
Assembly Source File
|
1995-02-15
|
7KB
|
131 lines
; FFLF.COM Version 4.0
; Memory-resident program to send form feed and line feed
; characters to printer
; Alt-PrtSc = form feed
; Alt-/ = line feed
; Includes installation messages
; Checks printer status, beeps if printer not ready
; Written in CHeap ASseMbler format by :
; L. R. Holliday
; 218 Virginia
; Ponca City, Oklahoma 74601
fflf proc far
jmp set_up ; Jump to initialize
addr_bx ds 2,0 ; Space to store KBINT offset
addr_es ds 2,0 ; Space to store KBINT segment
kbint sti ; Interrupts on
push ax ; Store registers
push dx ; AX and DX
mov dx,0000h ; Select printer 1
mov ah,02 ; Get shift state
int 16h ; through BIOS
test al,04 ; Is Ctrl key pressed ?
jnz exit ; If so, jump to exit
test al,03 ; Is a Shift key pressed ?
jnz exit ; If so, jump to exit
test al,08 ; Is Alt key pressed ?
jz exit ; If not, jump to exit
in al,60h ; If so, get key scan code
cmp al,37h ; Is it PrtSc Key ?
jz formfeed ; If so, jump to Formfeed
cmp al,35h ; Is it / Key ?
jz linefeed ; If so, jump to Linefeed
jmps exit ; If none of above, jump to exit
formfeed call lptstat
jb beep
mov ax,000ch ; Put Formfeed character in AL
int 17h ; Send to printer
jmps kb_reset ; Jump to KeyBoard Reset
linefeed call lptstat
jb beep
mov ax,000ah ; Put Linefeed character in AL
int 17h ; Send to printer
jmps kb_reset ; Jump to KeyBoard Reset
beep mov ah,182
out 67,al
mov al,0
out 66,al
mov al,6
out 66,al
in al,97
or al,3
out 97,al
mov cx,6000h
beep1 loop beep1
in al,97
and al,252
out 97,al
kb_reset in al,61h ; These instructions reset the
mov ah,al ; keyboard
or al,80h ; ......
out 61h,al ; ......
mov al,ah ; ......
out 61h,al ; ......
cli ; Turn interrupts off
mov al,20h ; Send End-of-Interrupt
out 20h,al ; signal
pop dx ; Restore registers
pop ax ; DX and AX
iret ; Return to interrupted program
lptstat proc near
mov ah,02 ; check printer status
int 17h
cmp ah,90h ; is printer on-line ?
jz stat1 ; if so, then no error
stc ; raise error flag
ret
stat1 clc ; clear error flag
ret
endp
exit pop dx ; Restore registers
pop ax ; DX and AX
seg cs ; cs:
jmpf addr_bx ; Return to BIOS KBINT
set_up mov ah,30h ; Check DOS Version
int 21h
cmp al,2 ; Is it 2 or higher ?
jae check_install ; If so, check for prior installation
mov dx,offset(err_msg2)
jmps msg_exit ; If not, issue error message
check_install mov ax,0
mov es,ax
seg es ; es:
cmpw [04f3h],4444h ; Already installed ?
jnz install ; If not, install
mov dx,offset(err_msg1)
jmps msg_exit ; If not, issue error message
install seg es ; es:
movw [04f3h],4444h ; Set flag
mov ax,3509h ; Get BIOS KBINT address through
int 21h ; DOS GET_VECTOR service
mov addr_bx,bx ; Store offset and
mov addr_es,es ; segment in spaces allocated
mov dx,offset(kbint) ; Address of new KBINT
mov ax,2509h ; Set vector to new KBINT
int 21h ; through DOS SET_VECTOR service
mov dx,offset(inst_msg)
mov ah,9 ; Display installation message
int 21h
mov dx,offset(set_up) ; Address of end of resident code
int 27h ; Terminate, but stay resident
msg_exit mov ah,9 ; Display error message
int 21h
int 20h ; Terminate
end endp
inst_msg db 0dh,0ah,' F F L F Version 4.0',0dh,0ah
db 0dh,0ah,' Printer FormFeed and LineFeed Program',0dh,0ah
db 0dh,0ah,' Memory-Resident Portion Installed',0dh,0ah
db 0dh,0ah,'Press Alt-PrtSc to Send FormFeed to Printer',0dh,0ah
db 0dh,0ah,'Press Alt-/ to Send LineFeed to Printer',0dh,0ah,'$'
err_msg1 db 0dh,0ah,' F F L F Version 4.0',0dh,0ah
db 0dh,0ah,' Printer FormFeed and LineFeed Program',0dh,0ah
db 07,0dh,0ah,' --- Already Installed ---',0dh,0ah,'$'
err_msg2 db 0dh,0ah,' F F L F Version 4.0',0dh,0ah
db 0dh,0ah,' Printer FormFeed and LineFeed Program',0dh,0ah
db 07,0dh,0ah,' --- Wrong Dos Version ---',0dh,0ah,'$'